package de.koller.so.render.logo;

import de.koller.nature.proto.Terrain2D;
import de.koller.oceanFramework.gl.util.ImagePreview;
import de.koller.oceanFramework.math.Vec3;
import de.koller.oceanFramework.util.ColorIntUtil;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Random;

public class LandscapeRenderer {

	public static final Random RND = new Random();
	public static final int W = 128, H = 128;
	
	private static void fillHeightMap( HeightMap hm ) {
		int[][] m = Terrain2D.terrain( W );
		for( int x = 0; x < hm.map.length; x++ )
			for( int y = 0;  y < hm.map[0].length; y++ ) {
				hm.map[x][y] = m[x][y];
			}
	}
	
	private static void colorLight( LightMap lm ) {
		for( int x = 0; x < lm.basicColor.length; x++ )
			for( int y = 0;  y < lm.basicColor[0].length; y++ ) {
				lm.basicColor[x][y] = ColorIntUtil.getIntColor( 0xff, 0xff, 0, 0 );
			}
	}
	
	
	public static void main( String[] args ) {
		HeightMap h = new HeightMap( W, H );
		
		fillHeightMap( h );
		//ImagePreview.showImage( h.getVisual(), W, H );
		
		LightMap l = new LightMap( new Vec3( -1.5, 1, 2 ), h );
		
//		colorLight( l );
//		l.basicColor();
//		ImagePreview.showImage( l.getVisual(), W, H );
		
		l.calcBasicLight();
		ImagePreview.showImage( l.getVisual(), W*4, H*4 );
	}
	
	
}
